package com.example.springbootjasyptdemo;

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;

/**
 * @author chaird
 * @create 2022-08-13 12:23
 */
public class StringEncryptorDemo {

  public static void main(String[] args) {
    System.out.println("--------------加密----------------");
    StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor();
    // 秘钥
    standardPBEStringEncryptor.setPassword("demo");
    // 明文进行加密
    String code = standardPBEStringEncryptor.encrypt("123456");
    System.out.println(code);
    System.out.println("--------------解密----------------");
    // 解密
    String decrypt = standardPBEStringEncryptor.decrypt(code);
    System.out.println(decrypt);
  }
}
